package com.example.demo.controller;

import com.example.demo.entity.VO.pet.PetVO;
import com.example.demo.service.PetService;
import com.example.demo.wrapper.Result;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1")
public class petController {

    private final PetService petService;

    public petController(PetService petService) {
        this.petService = petService;
    }

    @GetMapping("/user/{userId}/pet/stateValue")
    public Result<PetVO> getPetStateValue(@PathVariable(value = "userId") Integer userId){
        return Result.buildSuccess(petService.getPetByUserId(userId));
    }

    @PutMapping("/user/pet/stateValue")
    public Result<Void> updatePetStateValue(@RequestBody PetVO petVO){
        petService.updatePet(petVO);

        return Result.buildSuccess();
    }
}
